// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]

/// Implements a client for the Cloud Run Admin API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_run_v2::client::Builds;
/// let client = Builds::builder().build().await?;
/// // use `client` to make requests to the Cloud Run Admin API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Cloud Run Build Control Plane API
///
/// # Configuration
///
/// To configure `Builds` use the `with_*` methods in the type returned
/// by [builder()][Builds::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://run.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::builds::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::builds::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Builds` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Builds` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct Builds {
    inner: std::sync::Arc<dyn super::stub::dynamic::Builds>,
}

impl Builds {
    /// Returns a builder for [Builds].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_run_v2::client::Builds;
    /// let client = Builds::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::builds::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::builds::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Builds + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Builds>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Builds> {
        super::transport::Builds::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Builds> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Builds::new)
    }

    /// Submits a build in a given project.
    pub fn submit_build(&self) -> super::builder::builds::SubmitBuild {
        super::builder::builds::SubmitBuild::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::builds::ListOperations {
        super::builder::builds::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::builds::GetOperation {
        super::builder::builds::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::builds::DeleteOperation {
        super::builder::builds::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::builds::WaitOperation {
        super::builder::builds::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Cloud Run Admin API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_run_v2::client::Executions;
/// let client = Executions::builder().build().await?;
/// // use `client` to make requests to the Cloud Run Admin API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Cloud Run Execution Control Plane API.
///
/// # Configuration
///
/// To configure `Executions` use the `with_*` methods in the type returned
/// by [builder()][Executions::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://run.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::executions::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::executions::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Executions` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Executions` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct Executions {
    inner: std::sync::Arc<dyn super::stub::dynamic::Executions>,
}

impl Executions {
    /// Returns a builder for [Executions].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_run_v2::client::Executions;
    /// let client = Executions::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::executions::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::executions::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Executions + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Executions>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Executions> {
        super::transport::Executions::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Executions> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Executions::new)
    }

    /// Gets information about an Execution.
    pub fn get_execution(&self) -> super::builder::executions::GetExecution {
        super::builder::executions::GetExecution::new(self.inner.clone())
    }

    /// Lists Executions from a Job. Results are sorted by creation time,
    /// descending.
    pub fn list_executions(&self) -> super::builder::executions::ListExecutions {
        super::builder::executions::ListExecutions::new(self.inner.clone())
    }

    /// Deletes an Execution.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_execution(&self) -> super::builder::executions::DeleteExecution {
        super::builder::executions::DeleteExecution::new(self.inner.clone())
    }

    /// Cancels an Execution.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn cancel_execution(&self) -> super::builder::executions::CancelExecution {
        super::builder::executions::CancelExecution::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::executions::ListOperations {
        super::builder::executions::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::executions::GetOperation {
        super::builder::executions::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::executions::DeleteOperation {
        super::builder::executions::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::executions::WaitOperation {
        super::builder::executions::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Cloud Run Admin API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_run_v2::client::Jobs;
/// let client = Jobs::builder().build().await?;
/// // use `client` to make requests to the Cloud Run Admin API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Cloud Run Job Control Plane API.
///
/// # Configuration
///
/// To configure `Jobs` use the `with_*` methods in the type returned
/// by [builder()][Jobs::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://run.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::jobs::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::jobs::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Jobs` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Jobs` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct Jobs {
    inner: std::sync::Arc<dyn super::stub::dynamic::Jobs>,
}

impl Jobs {
    /// Returns a builder for [Jobs].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_run_v2::client::Jobs;
    /// let client = Jobs::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::jobs::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::jobs::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Jobs + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Jobs>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Jobs> {
        super::transport::Jobs::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Jobs> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Jobs::new)
    }

    /// Creates a Job.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_job(&self) -> super::builder::jobs::CreateJob {
        super::builder::jobs::CreateJob::new(self.inner.clone())
    }

    /// Gets information about a Job.
    pub fn get_job(&self) -> super::builder::jobs::GetJob {
        super::builder::jobs::GetJob::new(self.inner.clone())
    }

    /// Lists Jobs. Results are sorted by creation time, descending.
    pub fn list_jobs(&self) -> super::builder::jobs::ListJobs {
        super::builder::jobs::ListJobs::new(self.inner.clone())
    }

    /// Updates a Job.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_job(&self) -> super::builder::jobs::UpdateJob {
        super::builder::jobs::UpdateJob::new(self.inner.clone())
    }

    /// Deletes a Job.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_job(&self) -> super::builder::jobs::DeleteJob {
        super::builder::jobs::DeleteJob::new(self.inner.clone())
    }

    /// Triggers creation of a new Execution of this Job.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn run_job(&self) -> super::builder::jobs::RunJob {
        super::builder::jobs::RunJob::new(self.inner.clone())
    }

    /// Gets the IAM Access Control policy currently in effect for the given Job.
    /// This result does not include any inherited policies.
    pub fn get_iam_policy(&self) -> super::builder::jobs::GetIamPolicy {
        super::builder::jobs::GetIamPolicy::new(self.inner.clone())
    }

    /// Sets the IAM Access control policy for the specified Job. Overwrites
    /// any existing policy.
    pub fn set_iam_policy(&self) -> super::builder::jobs::SetIamPolicy {
        super::builder::jobs::SetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified Project.
    ///
    /// There are no permissions required for making this API call.
    pub fn test_iam_permissions(&self) -> super::builder::jobs::TestIamPermissions {
        super::builder::jobs::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::jobs::ListOperations {
        super::builder::jobs::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::jobs::GetOperation {
        super::builder::jobs::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::jobs::DeleteOperation {
        super::builder::jobs::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::jobs::WaitOperation {
        super::builder::jobs::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Cloud Run Admin API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_run_v2::client::Revisions;
/// let client = Revisions::builder().build().await?;
/// // use `client` to make requests to the Cloud Run Admin API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Cloud Run Revision Control Plane API.
///
/// # Configuration
///
/// To configure `Revisions` use the `with_*` methods in the type returned
/// by [builder()][Revisions::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://run.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::revisions::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::revisions::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Revisions` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Revisions` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct Revisions {
    inner: std::sync::Arc<dyn super::stub::dynamic::Revisions>,
}

impl Revisions {
    /// Returns a builder for [Revisions].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_run_v2::client::Revisions;
    /// let client = Revisions::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::revisions::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::revisions::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Revisions + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Revisions>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Revisions> {
        super::transport::Revisions::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Revisions> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Revisions::new)
    }

    /// Gets information about a Revision.
    pub fn get_revision(&self) -> super::builder::revisions::GetRevision {
        super::builder::revisions::GetRevision::new(self.inner.clone())
    }

    /// Lists Revisions from a given Service, or from a given location.  Results
    /// are sorted by creation time, descending.
    pub fn list_revisions(&self) -> super::builder::revisions::ListRevisions {
        super::builder::revisions::ListRevisions::new(self.inner.clone())
    }

    /// Deletes a Revision.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_revision(&self) -> super::builder::revisions::DeleteRevision {
        super::builder::revisions::DeleteRevision::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::revisions::ListOperations {
        super::builder::revisions::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::revisions::GetOperation {
        super::builder::revisions::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::revisions::DeleteOperation {
        super::builder::revisions::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::revisions::WaitOperation {
        super::builder::revisions::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Cloud Run Admin API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_run_v2::client::Services;
/// let client = Services::builder().build().await?;
/// // use `client` to make requests to the Cloud Run Admin API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Cloud Run Service Control Plane API
///
/// # Configuration
///
/// To configure `Services` use the `with_*` methods in the type returned
/// by [builder()][Services::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://run.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::services::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::services::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Services` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Services` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct Services {
    inner: std::sync::Arc<dyn super::stub::dynamic::Services>,
}

impl Services {
    /// Returns a builder for [Services].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_run_v2::client::Services;
    /// let client = Services::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::services::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::services::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Services + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Services>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Services> {
        super::transport::Services::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Services> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Services::new)
    }

    /// Creates a new Service in a given project and location.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_service(&self) -> super::builder::services::CreateService {
        super::builder::services::CreateService::new(self.inner.clone())
    }

    /// Gets information about a Service.
    pub fn get_service(&self) -> super::builder::services::GetService {
        super::builder::services::GetService::new(self.inner.clone())
    }

    /// Lists Services. Results are sorted by creation time, descending.
    pub fn list_services(&self) -> super::builder::services::ListServices {
        super::builder::services::ListServices::new(self.inner.clone())
    }

    /// Updates a Service.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_service(&self) -> super::builder::services::UpdateService {
        super::builder::services::UpdateService::new(self.inner.clone())
    }

    /// Deletes a Service.
    /// This will cause the Service to stop serving traffic and will delete all
    /// revisions.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_service(&self) -> super::builder::services::DeleteService {
        super::builder::services::DeleteService::new(self.inner.clone())
    }

    /// Gets the IAM Access Control policy currently in effect for the given
    /// Cloud Run Service. This result does not include any inherited policies.
    pub fn get_iam_policy(&self) -> super::builder::services::GetIamPolicy {
        super::builder::services::GetIamPolicy::new(self.inner.clone())
    }

    /// Sets the IAM Access control policy for the specified Service. Overwrites
    /// any existing policy.
    pub fn set_iam_policy(&self) -> super::builder::services::SetIamPolicy {
        super::builder::services::SetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified Project.
    ///
    /// There are no permissions required for making this API call.
    pub fn test_iam_permissions(&self) -> super::builder::services::TestIamPermissions {
        super::builder::services::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::services::ListOperations {
        super::builder::services::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::services::GetOperation {
        super::builder::services::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::services::DeleteOperation {
        super::builder::services::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::services::WaitOperation {
        super::builder::services::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Cloud Run Admin API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_run_v2::client::Tasks;
/// let client = Tasks::builder().build().await?;
/// // use `client` to make requests to the Cloud Run Admin API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Cloud Run Task Control Plane API.
///
/// # Configuration
///
/// To configure `Tasks` use the `with_*` methods in the type returned
/// by [builder()][Tasks::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://run.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::tasks::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::tasks::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `Tasks` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `Tasks` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct Tasks {
    inner: std::sync::Arc<dyn super::stub::dynamic::Tasks>,
}

impl Tasks {
    /// Returns a builder for [Tasks].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_run_v2::client::Tasks;
    /// let client = Tasks::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::tasks::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::tasks::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::Tasks + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Tasks>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Tasks> {
        super::transport::Tasks::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::Tasks> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::Tasks::new)
    }

    /// Gets information about a Task.
    pub fn get_task(&self) -> super::builder::tasks::GetTask {
        super::builder::tasks::GetTask::new(self.inner.clone())
    }

    /// Lists Tasks from an Execution of a Job.
    pub fn list_tasks(&self) -> super::builder::tasks::ListTasks {
        super::builder::tasks::ListTasks::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::tasks::ListOperations {
        super::builder::tasks::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::tasks::GetOperation {
        super::builder::tasks::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::tasks::DeleteOperation {
        super::builder::tasks::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::tasks::WaitOperation {
        super::builder::tasks::WaitOperation::new(self.inner.clone())
    }
}

/// Implements a client for the Cloud Run Admin API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_run_v2::client::WorkerPools;
/// let client = WorkerPools::builder().build().await?;
/// // use `client` to make requests to the Cloud Run Admin API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// Cloud Run WorkerPool Control Plane API.
///
/// # Configuration
///
/// To configure `WorkerPools` use the `with_*` methods in the type returned
/// by [builder()][WorkerPools::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://run.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::worker_pools::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::worker_pools::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `WorkerPools` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `WorkerPools` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct WorkerPools {
    inner: std::sync::Arc<dyn super::stub::dynamic::WorkerPools>,
}

impl WorkerPools {
    /// Returns a builder for [WorkerPools].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_run_v2::client::WorkerPools;
    /// let client = WorkerPools::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::worker_pools::ClientBuilder {
        gax::client_builder::internal::new_builder(super::builder::worker_pools::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::WorkerPools + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::WorkerPools>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::WorkerPools> {
        super::transport::WorkerPools::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::WorkerPools> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::WorkerPools::new)
    }

    /// Creates a new WorkerPool in a given project and location.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_worker_pool(&self) -> super::builder::worker_pools::CreateWorkerPool {
        super::builder::worker_pools::CreateWorkerPool::new(self.inner.clone())
    }

    /// Gets information about a WorkerPool.
    pub fn get_worker_pool(&self) -> super::builder::worker_pools::GetWorkerPool {
        super::builder::worker_pools::GetWorkerPool::new(self.inner.clone())
    }

    /// Lists WorkerPools. Results are sorted by creation time, descending.
    pub fn list_worker_pools(&self) -> super::builder::worker_pools::ListWorkerPools {
        super::builder::worker_pools::ListWorkerPools::new(self.inner.clone())
    }

    /// Updates a WorkerPool.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn update_worker_pool(&self) -> super::builder::worker_pools::UpdateWorkerPool {
        super::builder::worker_pools::UpdateWorkerPool::new(self.inner.clone())
    }

    /// Deletes a WorkerPool.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_worker_pool(&self) -> super::builder::worker_pools::DeleteWorkerPool {
        super::builder::worker_pools::DeleteWorkerPool::new(self.inner.clone())
    }

    /// Gets the IAM Access Control policy currently in effect for the given
    /// Cloud Run WorkerPool. This result does not include any inherited policies.
    pub fn get_iam_policy(&self) -> super::builder::worker_pools::GetIamPolicy {
        super::builder::worker_pools::GetIamPolicy::new(self.inner.clone())
    }

    /// Sets the IAM Access control policy for the specified WorkerPool. Overwrites
    /// any existing policy.
    pub fn set_iam_policy(&self) -> super::builder::worker_pools::SetIamPolicy {
        super::builder::worker_pools::SetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that a caller has on the specified Project.
    ///
    /// There are no permissions required for making this API call.
    pub fn test_iam_permissions(&self) -> super::builder::worker_pools::TestIamPermissions {
        super::builder::worker_pools::TestIamPermissions::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::worker_pools::ListOperations {
        super::builder::worker_pools::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::worker_pools::GetOperation {
        super::builder::worker_pools::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::worker_pools::DeleteOperation {
        super::builder::worker_pools::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn wait_operation(&self) -> super::builder::worker_pools::WaitOperation {
        super::builder::worker_pools::WaitOperation::new(self.inner.clone())
    }
}
